package com.easy.demo.controller;

import com.basic.domain.ResultVo;
import com.easy.annotations.RestMapping;
import com.easy.annotations.Validation;
import com.easy.demo.entity.User;
import com.easy.demo.validation.ValidUser;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 自定义参数校验逻辑 控制器
 *
 * @author LZH
 * @version 1.0.11
 * @since 2023/12/31
 */
@RestMapping("valid")
public class ValidController {

    /**
     * 自定义校验 {@link User} 对象
     *
     * @param user {@link User}
     * @return {@link ResultVo}
     */
    @PostMapping
    @Validation(ValidUser.class)
    public ResultVo<Void> validUser(@RequestBody User user) {
        System.out.println("通过校验");
        return ResultVo.ok();
    }

}
